using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BanZuiCloudControlAgent.Core.Tasks.Enums;
using BanZuiCloudControlAgent.Core.Tasks.Models;

namespace BanZuiCloudControlAgent.Core.Tasks.Base
{
    /// <summary>
    /// 任务接口，定义所有任务必须实现的方法和属性
    /// </summary>
    public interface ITask
    {
        /// <summary>
        /// 任务ID
        /// </summary>
        string TaskId { get; set; }
        
        /// <summary>
        /// 任务类型
        /// </summary>
        TaskType TaskType { get; set; }
        
        /// <summary>
        /// 任务状态
        /// </summary>
        TaskState Status { get; set; }
        
        /// <summary>
        /// 任务优先级
        /// </summary>
        TaskPriority Priority { get; set; }
        
        /// <summary>
        /// 任务参数
        /// </summary>
        Dictionary<string, object> Parameters { get; set; }
        
        /// <summary>
        /// 任务进度（0-100）
        /// </summary>
        int Progress { get; }
        
        /// <summary>
        /// 任务结果
        /// </summary>
        TaskResult Result { get; }
        
        /// <summary>
        /// 任务创建时间
        /// </summary>
        DateTime CreateTime { get; set; }
        
        /// <summary>
        /// 任务开始时间
        /// </summary>
        DateTime? StartTime { get; }
        
        /// <summary>
        /// 任务完成时间
        /// </summary>
        DateTime? CompleteTime { get; }
        
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="context">任务上下文</param>
        /// <returns>任务结果</returns>
        Task<TaskResult> ExecuteAsync(TaskContext context);
        
        /// <summary>
        /// 暂停任务
        /// </summary>
        Task PauseAsync();
        
        /// <summary>
        /// 恢复任务
        /// </summary>
        Task ResumeAsync();
        
        /// <summary>
        /// 取消任务
        /// </summary>
        Task CancelAsync();
        
        /// <summary>
        /// 进度变化事件
        /// </summary>
        event EventHandler<int> ProgressChanged;
    }
} 